package com.bw.dao;

import com.bw.pojo.Goods;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/***************************
 FileAction:

 CreateTime:2022-08-01 9:37
 Author:Aaking-aline
 ****************************/
public interface GoodsDao {

	@Insert("insert into goods values(null,#{goods_name},#{goods_price},#{goods_des},#{goods_insert_time},#{goods_update_time},#{goods_img})")
	void insertGoods(Goods goods);

	@Delete("delete from goods where id = #{id}")
	void deleteGoods(String id);

	@Update("update goods set goods_name = #{goods_name}," +
			"goods_price = #{goods_price}," +
			"goods_des = #{goods_des}," +
			"goods_update_time = #{goods_update_time}," +
			"goods_img = #{goods_img} where id = #{id}")
	void updateGoods(Goods goods);

	@Select("select * from goods")
	List<Goods> selectAllGoods();

	@Select("select * from goods limit #{arg0},#{arg1}")
	List<Goods> selectPageGoods(int index, int number);

	@Select("select count(*) from goods")
	Integer getPageNum();

	@Select("select * from goods where goods_price > #{arg0} and goods_price < #{arg1}")
	List<Goods> selectGoodsByPrice(String a0, String a1);
}
